package dungeonPackage;

import static org.junit.Assert.*;

import org.junit.*;

import squareBorderPackage.*;

/**
 * A class collecting tests for the class of levels.
 * 
 * @author Jessa Bekker & Esther Alberts
 * @version 1.0
 */
public class LevelTest {

	/**
	 * Class variables referencing Levels that do not change during the
	 * entire test case.
	 */
	private static Level<Square> defaultLevel;

	/**
	 * Class variables referencing Orientations that do not change during the
	 * entire test case.
	 */
	private static Orientation defaultOrientation, orientation1, orientation2;

	
	/**
	 * Set up an immutable test fixture.
	 * 
	 * @post	The variable defaultOrientation references a new Orientation with coordinates (30,20,0)
	 * @post	The variable orientation1 references a new Orientation with coordinates (20,0,30)
	 * @post	The variable orientation2 references a new Orientation with coordinates (10,10,0)
	 * @post 	The variable defaultLevel references a new Level with maxCoordinates defaultOrientation
	 */
	@BeforeClass
	public static void setUpBeforeClass() {
		defaultOrientation = new Orientation(30, 20, 0);
		orientation1 = new Orientation(20, 0, 30);
		orientation2 = new Orientation(10, 10, 0);
		defaultLevel = new Level<Square>(defaultOrientation);
	}

	@Test
	public void initializeObject_LegalCase() {
		assertTrue(defaultLevel.getMaxCoordinates().equals(defaultOrientation));
	}

	@Test(expected = IllegalArgumentException.class)
	public void initializeObject_IllegalCase() throws IllegalArgumentException{
		new Level<Square>(orientation1);
	}
	
	@Test
	public void isValidOrientation_IllegalCases(){
		//orientatie null
		assertFalse(defaultLevel.isValidOrientation(null));
		//orientatie waarbij de z niet nul is
		assertFalse(defaultLevel.isValidOrientation(orientation1));
	}
	
	@Test
	public void isValidOrientation_LegalCases(){
		assertTrue(defaultLevel.isValidOrientation(orientation2));
	}
}
